package com.tensquare.user.config;

import com.tensquare.user.intercepter.JwtIntercepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 *
 * 拦截器
 * Created by DUZEYU on 2018/12/25.
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Autowired
    private JwtIntercepter jwtIntercepter;
    protected void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器 要声明连接的对象和连接的请求
        registry.addInterceptor(jwtIntercepter)
                .addPathPatterns("/**")
                .excludePathPatterns("/**/login/**");
    }
}
